﻿	      <?php include("conn.php");
             mysql_query('SET NAMES UTF8'); 

	  

class MyPrizeBean
{
	public $title;
	public $price;
	public $images;
	public $mainimages;
	public $yuanjia;
	public $goodsid;
	public $reply;
	public $xihuan;
	public $summary;
	public $xiaoliang;

	function __construct($title,$price,$images,$mainimages,$yuanjia,$goodsid,$reply,$xihuan,$summary,$xiaoliang)
	{
		$this->title      = $title;
		$this->price = $price;
		$this->images     = $images;
		$this->mainimages     = $mainimages;
		$this->yuanjia      = $yuanjia;
		$this->goodsid    = $goodsid;
		$this->reply    = $reply;
		$this->xihuan    = $xihuan;
		$this->summary    = $summary;
		$this->xiaoliang    = $xiaoliang;
	}
}

		if($_REQUEST['page']!="")
		{
			$de=$_REQUEST['page']*$_REQUEST['pagesize'];
			$size=$_REQUEST['pagesize'];
		}

		else
		{
			$de=0;
			$size=5;
		}


    //$sj=1;
    
	/**$rert30=mysql_query("select *from goods  where  shopid ='".$_REQUEST[shopid]."' and shangjia='".$sj."' order by goodsid desc limit $de,$size");**/
	
	$rert30=mysql_query("select * from goods  where  shopid ='".$_REQUEST[shopid]."' order by goodsid desc limit $de,$size");

	$prize = array();
	
	while($rowf=mysql_fetch_array($rert30)){
	
	$images = explode(',', $rowf['images']);
	if ($images[$rowf[defaultImgOrd]] !='') {
		$defaultImg = $images[$rowf[defaultImgOrd]];
	}else{
		$defaultImg = $image[0];
	}
	$mainimages = $defaultImg;
	
	$prize[] = new MyPrizeBean($rowf['title'],$rowf['price'],$rowf['images'],$mainimages,$rowf['yuanjia'],$rowf['goodsid'],$rowf['replynumber'],$rowf['xihuan'],$rowf['summary'],$rowf['xiaoliang']);
		
	}

echo json_encode($prize);

?>